package com.ruoyi.irtu.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.irtu.mapper.IrtuDeviceMapper;
import com.ruoyi.irtu.domain.IrtuDevice;
import com.ruoyi.irtu.service.IIrtuDeviceService;

/**
 * 设备Service业务层处理
 * 
 * @author wb
 * @date 2023-03-13
 */
@Service
public class IrtuDeviceServiceImpl implements IIrtuDeviceService 
{
    @Autowired
    private IrtuDeviceMapper irtuDeviceMapper;

    /**
     * 查询设备
     * 
     * @param deviceId 设备主键
     * @return 设备
     */
    @Override
    public IrtuDevice selectIrtuDeviceByDeviceId(Long deviceId)
    {
        return irtuDeviceMapper.selectIrtuDeviceByDeviceId(deviceId);
    }

    /**
     * 查询设备列表
     * 
     * @param irtuDevice 设备
     * @return 设备
     */
    @Override
    public List<IrtuDevice> selectIrtuDeviceList(IrtuDevice irtuDevice)
    {
        return irtuDeviceMapper.selectIrtuDeviceList(irtuDevice);
    }

    /**
     * 新增设备
     * 
     * @param irtuDevice 设备
     * @return 结果
     */
    @Override
    public int insertIrtuDevice(IrtuDevice irtuDevice)
    {
        irtuDevice.setCreateTime(DateUtils.getNowDate());
        return irtuDeviceMapper.insertIrtuDevice(irtuDevice);
    }

    /**
     * 修改设备
     * 
     * @param irtuDevice 设备
     * @return 结果
     */
    @Override
    public int updateIrtuDevice(IrtuDevice irtuDevice)
    {
        irtuDevice.setUpdateTime(DateUtils.getNowDate());
        return irtuDeviceMapper.updateIrtuDevice(irtuDevice);
    }

    /**
     * 批量删除设备
     * 
     * @param deviceIds 需要删除的设备主键
     * @return 结果
     */
    @Override
    public int deleteIrtuDeviceByDeviceIds(Long[] deviceIds)
    {
        return irtuDeviceMapper.deleteIrtuDeviceByDeviceIds(deviceIds);
    }

    /**
     * 删除设备信息
     * 
     * @param deviceId 设备主键
     * @return 结果
     */
    @Override
    public int deleteIrtuDeviceByDeviceId(Long deviceId)
    {
        return irtuDeviceMapper.deleteIrtuDeviceByDeviceId(deviceId);
    }
}
